<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="p" uri="/WEB-INF/tld/page.tld" %>
<script type="text/javascript">
	function delStudentFromTeacher(studentId) {
		var teacherId = $('input[name="teacherId"]:checked').val();
		$.ajax({
			url:"/teach/deleteRelation/"+studentId+"-"+teacherId,
			dataType:"json"
		}).done(function(data){
			alert(data.msg);
			if(data.isSuccess) {
				$("#student-table-div").load("/teach/loadStudents/"+teacherId);
			}
		})
	}
</script>
<div class="box-content">
 	<a href="javascript:;" class="btn btn-sm btn-primary" onclick="addSonDict();">新增</a>
 	<!-- <a href="javascript:;" class="btn btn-sm btn-primary" onclick="updateDict();">修改</a>
 	<a href="javascript:;" class="btn btn-sm btn-primary" onclick="delDict();">删除</a> --><p/>
 	<table id="student-table" class="table table-striped table-bordered bootstrap-datatable datatable responsive">
	    <thead>
	    <tr>
	        <th>登录名</th>
	        <th>用户名</th>
	        <th>创建时间</th>
	        <th>操作</th>
	    </tr>
	    </thead>
	    <tbody>
	    <c:forEach items="${studentPage.list }" var="student">
	    <tr>
	        <td class="center">${student.loginname }</td>
	        <td class="center">${student.username }</td>
	        <td class="center">${student.create_time }</td>
	        <td class="center">
	            <!-- <a class="btn btn-success" href="#">
	                <i class="glyphicon glyphicon-zoom-in icon-white"></i>
	                View
	            </a> -->
	            <%-- <a class="btn btn-info" href="javascript:;" onclick='editUser("${user.id}");'>
	                <i class="glyphicon glyphicon-edit icon-white"></i> 编辑
	            </a> --%>
	            <a class="btn btn-danger" href="javascript:;" onclick='delStudentFromTeacher("${student.id}");'>
	                <i class="glyphicon glyphicon-trash icon-white"></i> 删除
	            </a>
	        </td>
	    </tr>
	    </c:forEach>
	    </tbody>
    </table>
</div>
   <div class="col-md-5">
	<div class="dataTables_info">第${studentPage.pageNumber }/${studentPage.totalPage }页,共${studentPage.totalRow }条记录</div>
</div>
<p:page pageNumber="${studentPage.pageNumber }" totalPage="${studentPage.totalPage }"
	 totalRow="${studentPage.totalRow }" width="5"/>>